<?php
session_start();
if($_SESSION["name"] == null){
  echo <<<END
      <script type="text/javascript">
       alert("请登录访问！");
       location.href="../login.html";
      </script>
END;
}

?>

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>教学任务查询页</title>
	<link rel="stylesheet" type="text/css" href="/28/inc/CSS/tTask.css">
	<link rel="stylesheet" type="text/css" href="/28/inc/CSS/reset.css">
  <script type="text/javascript" src="../inc/js/mamx.js"></script>
	<?php
//  1903010328 连接数据库
include "../inc/data/conn.php";

//--班级
//1903010328 绑定参数
$sql = "select classname from mamx_class";
  if($stmtCl = $conn->prepare($sql)){
  //  1903010328 执行 绑定结果
  $stmtCl->execute();
  $stmtCl->bind_result($classname);
  //  1903010328 保存结果
  $stmtCl->store_result();
  }
?>
<!--课程列表-->
<?php
// 1903101328  绑定参数
  $sql = "select coname from mamx_course";
  if($stmtconame = $conn->prepare($sql)){
  //  1903010328 执行 绑定结果
  $stmtconame->execute();
  $stmtconame->bind_result($coname);
  //  1903010328 保存结果
  $stmtconame->store_result();
  }
?>
<!-- 学院列表-->
<?php
  // 1903101328  绑定参数
  $sql = "select depname from mamx_dep";
  if($stmtdepname = $conn->prepare($sql)){
  //  1903010328 执行 绑定结果
  $stmtdepname->execute();
  $stmtdepname->bind_result($depname);
  //  1903010328 保存结果
  $stmtdepname->store_result();
  }
?>
<!--教师列表-->
<?php
	//1903010328  绑定参数
  $sql = "select tename,teid from mamx_teacher ";
  if($stmtte = $conn->prepare($sql)){
  //  1903010328 执行 绑定结果
  $stmtte->execute();
  $stmtte->bind_result($tename,$teid);
  //  1903010328 保存结果
  $stmtte->store_result();
  }
?>
<!-- 学年-->
<?php
  // 1903101328  绑定参数
  $sql = "select taskterm from mamx_task";
  if($stmtterm = $conn->prepare($sql)){
  //  1903010328 执行 绑定结果
  $stmtterm->execute();
  $stmtterm->bind_result($taskterm);
  //  1903010328 保存结果
  $stmtterm->store_result();
  }
?>


</head>
<body>
	<div id="tTask">
		<!--顶部-->
		<div id="top">
			<img src="/28/inc/pic/00.png">
			<!--导航栏区域和下拉列表-->
			<div id="top-rig">
			<ul>
			    <li><a href="">首页</a></li>
			    <li id="ddown"><a href="" id="dropbtn">学校概况</a>
				    <div id="ddown-content">
				    <a href="">学校简介</a>
				    <a href="">历任教师</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">国际合作</a>
				    <div id="ddown-content">
				    <a href="">交流概况</a>
				    <a href="">国际学生</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">院系部门</a>
				    <div id="ddown-content">
				    <a href="">党群机构</a>
				    <a href="">管理与服务机构</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">科学研究</a>
				    <div id="ddown-content">
				    <a href="">科研概况</a>
				    <a href="">重点学科</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">教师队伍</a>
				    <div id="ddown-content">
				    <a href="">总体介绍</a>
				    <a href="">杰出人才</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">人才培养</a>
				    <div id="ddown-content">
				    <a href="">继续教育</a>
				    <a href="">奖贷学金</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">人才招聘</a>
				    <div id="ddown-content">
				    <a href="">优秀博士后</a>
				    <a href="">应聘方式</a>
				    </div>
				</li>
                <li id="ddown"><a href="" id="dropbtn">招生就业</a>
				    <div id="ddown-content">
				    <a href="">本科生招生</a>
				    <a href="">就业服务</a>
				    </div>
				</li>
				<img src="/28/inc/pic/find.png">
		    </ul>
			</div>
		</div>
	    <!--顶部结束-->
	    <!---->
	    <div id="main">
	        <img src="/28/inc/pic/position.png">
	    	当前位置: 教师-教学任务查询
	    </div>
	    <div id="user">
		<img src="/28/inc/pic/user.png">
		<!-- 1903010328 动态信息 -->
		<h4><?php
			echo <<<end
			{$_SESSION["name"]} |
			身份：{$_SESSION["sf"]} |
			学号/职工号：{$_SESSION["id"]} |  
			学院：{$_SESSION["xy"]} 
end;
		?></h4>
	    </div>
		<div id="SZ">
		<ul>
	    	<li id="d1"><a href="/28/school/tScoreln.php">教师成绩录入</a></li>
	    	<li id="d1"><a herf="/28/school/tTask.php">教学任务查询</a></li>
	    	<li id="d1"><a herf="/28/school/user.php">用户设置</a></li>
	    	<li id="d1"><a herf="/28/school/me.php">上传头像</a></li>
	    	<li id="del"><a href="../quit.php">注销</a></li></ul>
	    </div>
	    <!--结束-->
	    <!--表格区域-->
	    <div id="list">
	    		<h2>查询条件</h2>
	    		    <form method="post" action="" name="mmxTask">
	    		    <li id="cx">学年
	    		    <select name="studyY" class="study_year" id="">
	    		    	<?php
              //  1903010328 产生学年 
               if (date("m")<10) {
          for ($i=(int)date("Y")+1;$i>=2004;$i--){
            $y=$i+1;
            $val=substr($i,-2).substr($y,-2);
          echo <<<END
                <option value="$val">$i-$y</option>
END;
        }
        }
        else{
          for ($i=(int)date("Y");$i>=2004;$i--){
            $y=$i+1;
            $val=substr($i,-2).substr($y,-2);
          echo <<<END
            <option value="$val">$i-$y</option>
END;
        }
        }
              ?>
            
	    		    </select> 
	    		   学期
	    		   <select name="term" class="term">
	    		    	<option value="01">1</option>
	    		    	<option value="02">2</option>
	    		    </select> 
	    		    系
	    		    <select name="depname" class="dep" id="se1">
	    		    	<?php
               if ($stmtdepname->num_rows > 0){
                   while($stmtdepname->fetch())
                   {
                    echo <<<END
                         <option value="$depname">$depname</option>
END;
                   }
               }
               
               else{
                     echo <<<END
                     <option value="">暂无记录</option>
END;
               }
              ?>
	    		    </select>
	    		    <input type="button" value=" 查询" class="s_but" name="s1">
	    		    </li><br/>
	    			 <li id="cx">按班级查询>>班级:
	    				 <select name="classname" class="stuclass" id="se1">
	    					<?php
               if ($stmtCl->num_rows > 0){
                   while($stmtCl->fetch())
                   {
                    echo <<<END
                         <option value="$classname">$classname</option>
END;
                   }
               }
               else{
                     echo <<<END
                     <option value="">暂无记录</option>
END;
               }
              ?>
	    				<input type="button" value="查询" class="s_but" name="s1" onclick="show(document.mmxTask.studyY.value+''+document.mmxTask.term.value,document.mmxTask.classname.value);">
	    				</select>
	    			 </li><br/>
	    			<li id="cx">按课程查询>>课程:
	    				<select name="coid" class="course" id="se1">
	    						    					<?php
               					if ($stmtconame->num_rows > 0){
                   					while($stmtconame->fetch())
                   					{
                    				echo <<<END
                         			<option value="$coname">$coname</option>
END;
                   }
               }
               else{
                     echo <<<END
                     <option value="">暂无记录</option>
END;
               }
              ?>
	    				<input type="button" value="查询" class="s_but" name="s2">
	    			</select>
	    			</li><br/>
	    			
	    				<li id="cx">按教师查询>>教师:
	    				 <select name="teid" class="tename" id="se1">
	    						<?php
               if ($stmtte->num_rows > 0){
                   while($stmtte->fetch())
                   {
                    echo <<<END
                         <option value="$teid">$tename</option>
END;
                   }
               }
               else{
                     echo <<<END
                     <option value="">暂无记录</option>
END;
               }
              ?>
	    				
	    				 <input type="submit" value="查询" class="s_but" name="s3">
             </select>
          </li>
</form>
	        <div id="execl">
	        
    
	    	</div>
	    </div>
	    <!--表格区域结束-->
	</div>
	<!--底部区域-->
	<div id="footer">
		<img src="/28/inc/pic/footer.png">
		<p>哈尔滨市南岗区西大直街92号 查号台：+86-451-86412114 P.C.:150001 Copyright © 2020  哈尔滨工业大学网络与信息中心 黑ICP备05006863号</p>
	</div>
	<!--底部区域结束-->
</body>
</html>